/**
 * Base object creator for views.
 */

function View(id) {
	var that = {};
	
	var backGroupId = id + "-back-group";
	that.initBack = function() {
		qype.backStack.addGroup(backGroupId);
	};

	that.addBack = function(backId, onclick) {
		qype.backStack.add(backGroupId, backId, onclick);
	};
	
	that.showBack = function(backId) {
		qype.backStack.show(backGroupId, backId);
	};
	
	that.showBackMwl = function(backId) {
		return qype.backStack.showMwl(backGroupId, backId);
	};
	
	that.getId = function(){
		return id;
	};
	
	that.getContainer = function() {
		return $("#"+id);
	};
	
	that.show = function(reset) {
		if(reset && this.reset) this.reset();
		qype.backStack.showGroup(backGroupId);
	};
	
	that.showMwl = function(reset) {
		return (reset && this.resetMwl ? this.resetMwl() : "") + qype.backStack.showGroupMwl(backGroupId);
	};
	
	return that;
}
